package com.isoft.demo.dao;

import com.isoft.demo.entity.CustomerInfo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface CustomerDao {
    //新增
    @Insert("insert into customer(cname,cphone,user_name,password) values (#{cname},#{cphone},#{user_name},#{password})")
    int addCustomer(CustomerInfo customerInfo);
    //修改密码
    @Update("update customer set password=#{password} where cid=#{cid}")
    int updateCustomer(CustomerInfo customerInfo);
    //修改个人信息
    @Update("update customer set cphone=#{cphone} where cid=#{cid}")
    int updateCus(CustomerInfo customerInfo);
    //删除
    @Delete("delete from customer where cid=#{cid}")
    int deleteCustomer(int cid);
    //查询
    @Select("select * from customer")
    List<CustomerInfo> findAll();
    @Select("select * from customer where user_name=#{user_name} and password=#{password}")
    CustomerInfo login(CustomerInfo customerInfo);
    //根据id查询
    @Select("select * from customer where cid=#{cid}")
    List<CustomerInfo> findById(Integer cid);
}
